<template>
  <div v-if="Object.keys(rate).length !== 0" class="rate">
    <div class="rate-header">
      <div>用户评价</div>
      <div>更多<i class="arrow-right"></i></div>
    </div>
    <div class="rate-users">
      <div class="avatar">
        <img :src="rate.list[0].user.avatar" alt="">
        <span>{{rate.list[0].user.uname}}</span>
      </div>
      <div class="rate-detail">
        <div class="content">{{rate.list[0].content}}</div>
        <div class="other">
          <span>{{rate.list[0].created | fmtDate}}</span>
          <span>{{ rate.list[0].style }}</span>
        </div>
<!--        <div class="imgs" v-if="rate.list[0].user.profile.length !== 0"></div>-->
        <div class="explain">{{ rate.list[0].explain }}</div>
      </div>

    </div>
  </div>
</template>

<script>
import Moment from 'moment'
export default {
  name: "DetailCommentInfos",
  props: {
    rate: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  filters: {
    fmtDate(time) {
      let date = new Date(time*1000)
      return Moment(date).format('YYYY-MM-DD')
    }
  }
}
</script>

<style scoped>
.rate {
  overflow: hidden;
  padding: 0 20px 10px 20px;
  border-bottom: 5px solid #f2f5f8;
}

.rate .rate-header {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  line-height: 45px;
  align-items: center;
  border-bottom: 2px solid #f2f5f8;
  font-size: 14px;
}

.rate .rate-header>div:last-child {
  font-size: 13px;
}
.rate .rate-users .avatar{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 10px;
}
.rate .rate-users .avatar img{
  width: 45px;
  height: 45px;
  border-radius: 50%;
}
.rate .rate-users .avatar span{
  line-height: 45px;
  margin-left: 10px;
  /*vertical-align: center;*/
}
.rate .rate-detail{
  padding: 10px 0;
  border-bottom: 2px solid #f2f5f8;
}
.rate .rate-detail .content{
  text-indent: 2em;
}
.rate .rate-detail .other{
  color: #999;
  font-size: 12px;
  margin-top: 10px;
}
.rate .rate-detail .other>span{
  margin-right: 10px;
}
.rate .explain{
  margin-top: 10px;
  line-height: 1.3;
  /*文本溢出隐藏*/
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/*公共样式*/
.arrow-right {
  border-top: 1px solid #999;
  border-left: 1px solid #999;
  width: 9px;
  height: 9px;
  background-color: transparent;
  -webkit-transform: rotate(
      135deg
  );
  transform: rotate(
      135deg
  );
  display: inline-block;
  margin-left: .1rem;
}
</style>